package project.ia04.agents.gui;

import jade.core.behaviours.CyclicBehaviour;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.MessageTemplate;

import org.codehaus.jackson.map.ObjectMapper;

import project.ia04.utils.Data;

public class EndGameListener extends CyclicBehaviour {

	@Override
	public void action() {
		MessageTemplate template = MessageTemplate.and(MessageTemplate.MatchPerformative(ACLMessage.INFORM),
				MessageTemplate.MatchConversationId(Data.ENDGAME));
		ACLMessage message = myAgent.receive(template);
		if(message != null){
			((XAgent)myAgent).send2Frame(Data.ENDGAME,message.getContent());
		}
		else
			block();
	}
}
